package com.example.handler;

import com.example.controller.Result;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;

@RestControllerAdvice
public class GlobalExceptionHandler {
    @ExceptionHandler(Exception.class)
    public Result handleException(Exception e) {
        return new Result(null, 0, e.getMessage() != null ? e.getMessage() : "发送了错误");
    }
}
